import React from 'react'
import {Navigate} from "react-router-dom";

export default function AuthComponent(props) {
    //如果已经登录
    if (localStorage.getItem('token'))
        return props.children;
    else
        return <Navigate to={'/login'}></Navigate>
 
}
